/*
============================================================================
 Name        : BlockPicCur.h
 Author      : \x{738b}\x{658c}
 Version     :
 Copyright   : \x{76ca}\x{76df}\x{8f6f}\x{4ef6}
 Description : CBlockPicCur declaration
============================================================================
*/

#ifndef BLOCKPICCUR_H
#define BLOCKPICCUR_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "BlockPic.h"
// CLASS DECLARATION

/**
*  CBlockPicCur
* 
*/

class TMinute
{
public:
	TInt16 m_sTime;
	TInt m_nPrice;
	TInt m_nAvePrice;
	TInt64 m_lVolume;
	TInt m_nStrong;

	TInt m_nSumAmt;
	TInt m_nAmount1;
	TInt m_nAmount2;
	TInt m_nAmount3;
	TInt m_nAmount4;
	
	TInt64 m_lTime;

public:
	TMinute()
	{
		m_sTime = 0;
		m_nPrice = 0;
		m_nAvePrice = 0;
		m_lVolume = 0;
		m_nStrong =0 ;
		m_nSumAmt = 0;
		m_nAmount1 = 0;
		m_nAmount2 =0;
		m_nAmount3 =0;
		m_nAmount4 = 0;
	}
public:
	TBool GetString(TInt nIndex, TInt nGroup, TDes& buf, TInt& bValue);
	TBool operator==(const TMinute& minute){return m_sTime == minute.m_sTime;}
};
class CBlockPicCur : public CBlockPic
{
public:
	~CBlockPicCur();

	static CBlockPicCur* NewL(CBaseBlock* bsBack, TBool aBlockType = EFalse);

	static CBlockPicCur* NewLC(CBaseBlock* bsBack, TBool aBlockType);

	CBlockPicCur(CBaseBlock* bsBack, TBool aBlockType);

private:
	void ConstructL();

public:
	//from CPic
	void CalcTB()const;

	void Time2String(TDes& aDes,const TInt32& nTime)const;

	void DrawCheck(CFbsBitGc& g)const;

	void OnDraw(CFbsBitGc& g)const;

	void OnInput(const TDesC8& strInput);

	void InitData();
	
	TInt32 GetMenuItem();

	TBool ReadData(const TDesC8& aData);
	
	void WriteData(TDes8& aBuf);

	TInt GetDataLength();

	TInt16 GetDataType();

	TInt GetDataSize()const;

	void SizeChanged();

	void OnKeyDown(TInt keyCode);

	TBool OnMenuEvent(TInt menuId);

	virtual void SetGoods(TInt nGoodsID);

	virtual void SetGoods(const TGoods& goods);

	void OnMouseUp(const TPoint& aPt);

private:
	//new functions
	void CalcMM();

	TInt Strong2Y(const TInt32& nValue)const;

	TInt GetAmt(int nCheckPos, TInt aId) const;

	void GoToGoodInfo();

	TBool GoToGoodInfo(TInt aPos);
	
	void DrawQuote(CFbsBitGc& g, TField& aField) const;

private:
	//TInt32 m_pnPrice[241];
	//TInt32 m_pnAvePrice[241];
	//TInt32 m_pnVolume[241];
	//TInt32 m_pnStrong[241];
	//TInt32 m_nMinute;
	//TInt8 m_bStrong;
	RArray<TMinute> m_vMinute;
	TUint8 m_bStrong;
	TBool m_nBlockType;//ETrue:\x{8d44}\x{91d1}\x{8d70}\x{52bf}

	TInt32 iGoodInfoTime;//\x{4e2a}\x{80a1}\x{8d44}\x{8baf}\x{65f6}\x{95f4}
	TInt64 iGoodInfoId;//\x{4e2a}\x{80a1}\x{8d44}\x{8baf}ID

	TBool iRequestOverTimeTip;
	HBufC* 	iStrOverTimeTip;
};

#endif // BLOCKPICCUR_H
